package com.example.flowermall.controller;

import com.example.flowermall.entity.Menu;
import com.example.flowermall.entity.Result;
import com.example.flowermall.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaoman
 * @since 2023-06-11
 */
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private IMenuService menuService;
    @GetMapping
    public Result getAllMenu(){
        List<Menu> menuList=menuService.getAllMenu();
        return Result.success(menuList);
    }

    @GetMapping("/list")
    public Result getMenuList(){
        return Result.success(menuService.getAllMenu());
    }

}
